package com.azt.provider.impl;

import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.azt.api.pojo.ReturnVisit;
import com.azt.api.service.ReturnVisitService;
import com.azt.model.page.Pagination;
import com.azt.provider.mapper.ReturnVisitMapper;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;

@Service
@Transactional
public class ReturnVisitServiceImpl implements ReturnVisitService
{

    private static final Logger log = LoggerFactory.getLogger(ReturnVisitServiceImpl.class);
    
	@Autowired
	private ReturnVisitMapper mapper;

    @Override
    public Pagination getReturnVisitPage(int pageno, int pagesize, Map<String, String> searchMap)
    {
        Page<Object> startPage = PageHelper.startPage(pageno, pagesize);
		List<ReturnVisit> contentList = mapper.getReturnVisitByParams(searchMap);
		Pagination p = new Pagination(startPage, contentList);
		p.setList(contentList);
		p.setParams(searchMap);
        return p;
        
    }
    
    @Override
    public void saveMsg(ReturnVisit returnvisit)
    {
    	mapper.insert(returnvisit);
    }
    
    @Override
    public void deleteAllById(Integer id)
    {
    	mapper.deleteByPrimaryKey(id);
    }
    
    @Override
    public void saveEdit(ReturnVisit returnvisit)
    {
    	mapper.updateByPrimaryKey(returnvisit);
    }
    
    
 	@Override
 	public ReturnVisit queryById(Integer id) 
 	{
 		return mapper.selectByPrimaryKey(id);
 	}
   




    
}
